using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using JGSY.CMS.LowCode.Platform.Domain.Interfaces;

namespace JGSY.CMS.LowCode.Platform.Domain.Entities
{
    /// <summary>
    /// 翻译文本实体
    /// 用于存储各种语言的翻译文本
    /// </summary>
    [Table("translations")]
    public class Translation : ITenantEntity
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 语言ID
        /// </summary>
        [Required]
        public long LanguageId { get; set; }

        /// <summary>
        /// 翻译键
        /// 如：common.save, menu.dashboard
        /// </summary>
        [Required]
        [StringLength(255)]
        public string Key { get; set; } = string.Empty;

        /// <summary>
        /// 翻译值
        /// 对应语言的文本内容
        /// </summary>
        [Column(TypeName = "text")]
        public string? Value { get; set; }

        /// <summary>
        /// 分组/模块
        /// 如：common, menu, validation
        /// </summary>
        [StringLength(100)]
        public string? Group { get; set; }

        /// <summary>
        /// 状态（启用/禁用）
        /// 0=禁用, 1=启用
        /// </summary>
        public byte Status { get; set; } = 1;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 语言导航属性
        /// </summary>
        [ForeignKey(nameof(LanguageId))]
        public Language? Language { get; set; }

        /// <summary>
        /// 租户标识符
        /// </summary>
        public string TenantId { get; set; } = string.Empty;
    }
}
